package com.ruoyi.pidaijiData.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.pidaijiData.domain.plat.DataPidaijiDmbhzyl;
import com.ruoyi.pidaijiData.service.IDataPidaijiDmbhzylService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 皮带机堆煤保护作用力测试项Controller
 * 
 * @author ruoyi
 * @date 2024-03-12
 */
@RestController
@RequestMapping("/pidaiji/dmbhzyl")
public class DataPidaijiDmbhzylController extends BaseController
{
    @Autowired
    private IDataPidaijiDmbhzylService dataPidaijiDmbhzylService;

    /**
     * 查询皮带机堆煤保护作用力测试项列表
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:dmbhzyl:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataPidaijiDmbhzyl dataPidaijiDmbhzyl)
    {
        startPage();
        List<DataPidaijiDmbhzyl> list = dataPidaijiDmbhzylService.selectDataPidaijiDmbhzylList(dataPidaijiDmbhzyl);
        return getDataTable(list);
    }

    /**
     * 导出皮带机堆煤保护作用力测试项列表
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:dmbhzyl:export')")
    @Log(title = "皮带机堆煤保护作用力测试项", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataPidaijiDmbhzyl dataPidaijiDmbhzyl)
    {
        List<DataPidaijiDmbhzyl> list = dataPidaijiDmbhzylService.selectDataPidaijiDmbhzylList(dataPidaijiDmbhzyl);
        ExcelUtil<DataPidaijiDmbhzyl> util = new ExcelUtil<DataPidaijiDmbhzyl>(DataPidaijiDmbhzyl.class);
        util.exportExcel(response, list, "皮带机堆煤保护作用力测试项数据");
    }

    /**
     * 获取皮带机堆煤保护作用力测试项详细信息
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:dmbhzyl:query')")
    @GetMapping(value = "/{dmId}")
    public AjaxResult getInfo(@PathVariable("dmId") Long dmId)
    {
        return success(dataPidaijiDmbhzylService.selectDataPidaijiDmbhzylByDmId(dmId));
    }

    /**
     * 新增皮带机堆煤保护作用力测试项
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:dmbhzyl:add')")
    @Log(title = "皮带机堆煤保护作用力测试项", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataPidaijiDmbhzyl dataPidaijiDmbhzyl)
    {
        return toAjax(dataPidaijiDmbhzylService.insertDataPidaijiDmbhzyl(dataPidaijiDmbhzyl));
    }

    /**
     * 修改皮带机堆煤保护作用力测试项
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:dmbhzyl:edit')")
    @Log(title = "皮带机堆煤保护作用力测试项", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataPidaijiDmbhzyl dataPidaijiDmbhzyl)
    {
        return toAjax(dataPidaijiDmbhzylService.updateDataPidaijiDmbhzyl(dataPidaijiDmbhzyl));
    }

    /**
     * 修改皮带机堆煤保护作用力测试项
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:dmbhzyl:remove')")
    @Log(title = "修改皮带机堆煤保护作用力测试项", businessType = BusinessType.UPDATE)
    @PutMapping("/editDmbhzyl/{dmId}")
    @ApiOperation(value="修改皮带机堆煤保护作用力测试项")
    public AjaxResult editDmbhzyl(@PathVariable Long dmId)
    {
        return toAjax(dataPidaijiDmbhzylService.updateDataPidaijiDmbhzylByDmId(dmId));
    }

    /**
     * 删除皮带机堆煤保护作用力测试项
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:dmbhzyl:remove')")
    @Log(title = "皮带机堆煤保护作用力测试项", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dmIds}")
    public AjaxResult remove(@PathVariable Long[] dmIds)
    {
        return toAjax(dataPidaijiDmbhzylService.deleteDataPidaijiDmbhzylByDmIds(dmIds));
    }
}
